import request from "@/utils/request";

export function cartsList() {
    return request({
        url: 'shopping/carts/getAll',
        method: 'get'
    })
}


export function updateCartItem(cartId, quantity) {
    return request({
        url: '/shopping/carts/update',
        method: 'put',
        params: {
            cartId,
            quantity
        }
    });
}


export function deleteCartItem(cartId) {
    return request({
        url: '/shopping/carts/delete',
        method: 'delete',
        params: {
            cartId
        }
    });
}

export function addCartItem(productId, quantity) {
    return request({
        url: '/shopping/carts/add',
        method: 'post',
        params: {
            productId,
            quantity
        }
    });
}

export function addOrder(params) {
    return request({
        url: '/shopping/orders/addOrder',
        method: 'post',
        data: params
    });
}

export function deleteAllCartItem() {
    return request({
        url: '/shopping/carts/deleteAll',
        method: 'delete'
    });
}

